
{% case template.name %}
  {% when 'page' %}
  {% assign current_url = page.url %}
  {% when 'blog' %}
  {% assign current_url = blog.url %}
  {% when 'article' %}
  {% assign current_url = article.url %}
  {% when 'collection' %}
  {% assign current_url = collection.url %}
  {% when 'product' %}
  {% assign current_url = product.url %}
{% endcase %}
{%- for link in linklists.noindex.links -%}
  {% if link.url == current_url %}
    <meta name="robots" content="noindex, nofollow">
  {% endif %}
  {%- if link.links != blank -%}
    {%- for child_link in link.links -%}
      {% if child_link.url == current_url %}
      <meta name="robots" content="noindex, nofollow">
      {% endif %}
    {%- if child_link.links != blank -%}
      {%- for grandchild_link in child_link.links -%}
      {% if grandchild_link.url == current_url %}
      <meta name="robots" content="noindex, nofollow">
      {% endif %}
      {%- endfor -%}
    {%- endif -%}
    {%- endfor -%}
  {%- endif -%}
{% endfor %}

{%- comment -%} 下面的代码我认为是无效的, 但是 apple 是这样子处理的 {%- endcomment -%}
{%- if template.name == 'login'
  or template.name == 'register'
  or template.name == 'reset_password'
  or template.name == 'account'
  or template.name == 'order'
  or template.name == 'addresses'
  or template.name == 'search'
  or template.name == '404'
-%}
  <meta name="robots" content="noindex, nofollow">
{%- endif -%}
